import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;

/**
 * @author caiwl
 * @date 2020/5/25 14:31
 */
public class TimeMain {
    public static void main(String[] args) {
        try {
            String time = "00:02";
            SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
            Calendar calendar = Calendar.getInstance();
            calendar.setTime(sdf.parse(time));
            System.out.println(calendar.getTime());
            calendar.add(Calendar.MINUTE, -5);
            System.out.println(calendar.getTime());
        } catch (ParseException e) {
            e.printStackTrace();
        }
    }
}
